<template>
  <div id="content">
    <div id="heading">
      <el-tabs v-model="activeName" @tab-click="handleClick" id="tab">
        <el-tab-pane label="全部" name="first">

          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>

        </el-tab-pane>
        <el-tab-pane label="华语" name="second">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="流行" name="third">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="民谣" name="fourth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="说唱" name="fifth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="摇滚" name="sixth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="电子" name="seventh">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="轻音乐" name="eighth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="影视原声" name="ninth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="ACG" name="tenth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="怀旧" name="eleventh">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="治愈" name="twelfth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="旅行" name="thirteenth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
        <el-tab-pane label="欧美" name="fourteenth">
          <ul class="topList-item">
            <li class="topList-img" v-for="(item,index) in list" :key="index" @click="toPlaylist(item.id)">
              <img :src="item.coverImgUrl" alt="" class="image">
              <span class="wen">{{item.name}}</span>
            </li>
          </ul>
        </el-tab-pane>
      </el-tabs>
      <!-- <div id="header">
        <span>音乐标题</span>
        <span>歌手</span>
        <span>专辑</span>
        <span>时长</span>
      </div> -->
    </div>

  </div>
</template>
<script>
  import axios from 'axios'
  export default {
    methods: {
      toPlaylist(id) {
        this.$router.push('/playlists?q=' + id)
      },
      handleClick(tab, event) {
        axios({
          url: 'http://music.eleuu.com/top/playlist',
          method: 'get',
          params: {
            limit: 60,
            offset: 0,
            cat: tab.label
          }
        }).then(res => {
          this.list = res.data.playlists
        })
      }
    },
    created() {
      axios({
        url: 'http://music.eleuu.com/top/playlist',
        method: 'get',
        params: {
          limit: 60,
          offset: 0,
          cat: '全部'
        }
      }).then(res => {
        this.list = res.data.playlists
      })
    },
    data() {
      return {
        label: [],
        banners: [],
        list: [],
        activeName: 'first'
      }
    }
  }

</script>
<style scoped>
  #heading {
    position: fixed;
    left: 110px;
    top: 160px;
    height: 60px;
    width: 1000px;
  }

  .el-tabs__item {
    color: white;
  }

  #content {
    color: rgb(255, 255, 255, 0.8);
    position: absolute;
    left: 0%;
    top: 50px;
    /* overflow-y: scroll; */
    /* overflow-x: hidden; */
    height: 400px;
    width: 1290px
  }

  ul {
    list-style: none;
    position: absolute;
    top: 30px;
    left: 0px;
    width: 1245px;
    height: 420px;
    overflow-y: scroll;
  }

  .topList-head {
    color: white;
    font-size: 20px;
    position: absolute;
    left: 8%;
    top: 0%;
  }

  .topList-head1 {
    color: white;
    font-size: 20px;
    position: absolute;
    left: 8%;
    top: 270%;
  }

  .topList-content {
    position: absolute;
    top: 48%;
    left: -2%;
    height: 50%;
    overflow: hidden;
    width: 100%;
    overflow-y: scroll;
    /* border: 1px solid white; */
  }

  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  /*定义滚动条轨道 内阴影+圆角*/
  ::-webkit-scrollbar-track {
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.3);
  }

  /*定义滑块 内阴影+圆角*/
  ::-webkit-scrollbar-thumb {
    border-radius: 5px;
    background-color: rgb(255, 255, 255, 0.7);
  }

  .image {
    width: 135px;
    height: 135px;
    object-fit: cover;
    border-radius: 5px;
    position: absolute;
    left: 0px;
    /* top: 10px; */
    float: left;
  }

  .topList-img {
    position: relative;
    width: 170px;
    height: 185px;
    margin: 10px 25px 5px 10px;
    float: left;
  }

  .topList-img1 {
    width: 165px;
    height: 125px;
    margin: 40px 20px;
    float: left;
    position: relative;
    top: 70px;
  }

  img {
    width: 100%;
    height: 100%;
  }

  .wen {
    position: absolute;
    left: 0px;
    top: 145px;
    font-size: 14px;
    width: 130px;
    display: -webkit-box;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-align: left;
    -webkit-box-orient: vertical;
  }

  .author {
    position: absolute;
    left: 550px;
    top: 30px;
    font-size: 14px;
  }

  .album {
    position: absolute;
    left: 750px;
    top: 30px;
    font-size: 14px;
  }

  .time {
    position: absolute;
    left: 920px;
    top: 30px;
    font-size: 14px;
  }

  #header {
    position: fixed;
    left: 230px;
    top: 220px;
  }

  #header span {
    position: absolute;
    left: 0px;
    width: 100px;
  }

  #header :nth-child(2) {
    left: 405px;
  }

  #header :nth-child(3) {
    left: 605px;
  }

  #header :nth-child(4) {
    left: 775px;
  }

</style>